feat: download and upload snapshot offline#382
Merged
peterpeterparker merged 26 commits intomainfrom Oct 3, 2025
Merged
Conversation
peterpeterparker
added a commit
to dfinity/icp-js-canisters
that referenced
this pull request
Oct 3, 2025
# Motivation When I developed support for the read and upload snapshot feature in #1046, I was really hesitant about whether to parse/map the metadata response. On one hand, for consistency with the other functions in the module, we should not parse the response, since none of the other functions do so. On the other hand, we already use custom parameters for the exposed parts of the module, a pattern that should also apply when implementing the upload metadata of the snapshot. Ultimately, I decided it would be more practical for the consumer to receive a mapped object when reading data. This way, the consumer can simply download a value and pass the same back on upload, without having to implement additional conversions on their side. I validated this approach with my implementation in Juno's CLI (PR [382](junobuild/cli#382)). That said, I’m still not fully satisfied with it. Generally speaking, I hope we’ll find a solution in the future that makes both inputs and outputs consistent. # Changes - Define a response type to read metadata - Add a utility to parse candid types to custom js type - Expose new module to consumer # Notes I exposed the all `snapshot.response` module in `index.ts`, not just the interface, for consistency reasons because we do so with the params. --------- Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.